package sortPeople;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

public class Solution {
    class Node {
        String name;
        int h;

        public Node(String name, int h) {
            this.name = name;
            this.h = h;
        }
    }
    public String[] sortPeople(String[] names, int[] heights) {
        Node[] nodes = new Node[names.length];
        for (int i = 0; i < names.length; i++) {
            nodes[i] = new Node(names[i],heights[i]);
        }
        Arrays.sort(nodes, (o1, o2) -> o2.h - o1.h);
        for (int i = 0; i < names.length; i++) {
            names[i] = nodes[i].name;
        }
        return names;
    }
}
